package com.learn.xueer.ui.activity

import android.os.Bundle
import com.blankj.utilcode.util.ActivityUtils
import com.blankj.utilcode.util.AppUtils
import com.learn.xueer.app.base.BaseActivity
import com.learn.xueer.app.util.CacheUtil
import com.learn.xueer.databinding.ActivitySetBinding
import com.learn.xueer.ui.viewmodel.MineViewModel
import kotlinx.android.synthetic.main.activity_set.tv_version
import me.hgj.jetpackmvvm.util.startActivity

/**
 * 我的页面
 */
class SetActivity : BaseActivity<MineViewModel, ActivitySetBinding>() {
    override fun initView(savedInstanceState: Bundle?) {
        mDatabind.click = ProxyClick()
        var appVersionName = AppUtils.getAppVersionName()
        tv_version.text="V${appVersionName}"
    }

    inner class ProxyClick {

        fun logout() {
            CacheUtil.setUser(null)
            CacheUtil.setIsLogin(false)
            CacheUtil.setToken("")
            ActivityUtils.startActivity(LoginActivity::class.java)
            ActivityUtils.finishAllActivities()
        }

        fun back() {
            finish()
        }

        fun userinfo() {
            startActivity(PersonDataActivity::class)
        }

        fun cancelAccount() {
            startActivity(CancelAccountActivity::class)
        }

        fun about() {
            startActivity(AboutAppActivity::class)
        }

        fun cancel() {
            startActivity(CancelExplainActivity::class)
        }

    }
}